{if $isTabbed == "false"}
    <h1>{$folder->getLabel()}</h1>
    <!-- for sortable -->
    <div id="folderLang" style="display:none">{$folder->getLang()}</div>
    <div id="folderId" style="display:none">{$folder->getUniqueId()}</div>

    <div id="moduleTabs">
	<ul>
	    <li><a href="{$URL_RELATIVE}/bo/#{$params.firstTabLink}" title="{$params.firstTabLabel}" rel="history"><span>{$params.firstTabLabel}</span></a></li>
	    <li><a href="{$URL_RELATIVE}/bo/#{$params.secondTabLink}" title="{t}Folder's properties{/t}" rel="history"><span>{t}Properties{/t}</span></a></li>
	</ul>
    </div>    

    <div id="ajaxTabLoader"><div id="loaderTabPic">{backend_image file="ajax-loader-big.gif"}</div></div>
{/if}

<div id="tabContent">
{if $tabName == "files" || $tabName == ""}
    {if count($documents) == 0}
    <div class="emptyFolder">
        {icon name="info.png"} {t}This folder is empty{/t}{hasRight rule=$moduleName|cat:"_Add"} - <a href="{$URL_RELATIVE}/bo/#{$params.newDocumentRoute}" class="greyButton nyroModal">{t}Click here to add a new document{/t}</a> {t}in this folder{/t}{/hasRight}
    </div>
    {elseif $documents == 'search'}
    <div class="emptyFolder">
        {t}No result{/t} - <a href="{$params.firstTabLink}" class="greyButton reload">{t}Click here to return{/t}</a>
    </div>
    {else}
	<div id="saveButton" style="display:block" >	    	    
        <ul class="saveButtons">
            {hasRight rule=$moduleName|cat:"_Edit"}
            <li class="first">
                <a href="{$URL_RELATIVE}/bo/#/?module=backoffice&action=AjaxDuplicatePublication" class="nyroModalResult">{icon name="documents.png"} {t}Duplicate{/t}</a>
            </li>
            <li>
                <a href="{$URL_RELATIVE}/bo/#/?module=backoffice&action=AjaxSwitchPublicationStatus" class="nyroModalResult">{icon name="refresh.png"} {t}Invert status{/t}</a>
            </li>
            {/hasRight}
            {hasRight rule=$moduleName|cat:"_Delete"}
            <li>
                <a href="{$URL_RELATIVE}/bo/#/?module=backoffice&action=AjaxDeleteFolderContent" class="nyroModalResult delete">{icon name="delete2.png"} {t}Delete{/t}</a>
            </li>
            {/hasRight}
        </ul>
        <div id="selectedelements"></div>
	</div>
    <div id="pagination">{block module="backoffice" action="AjaxPagination" nbDocTot=$pagination.nbDocTot nbDoc=$pagination.nbDoc numPage=$pagination.numPage}</div>
    <div id="documentListTableLoader"><div id="loaderPic">{backend_image file="ajax-loader-big.gif"}</div></div>
    <table class="documentListTable">
	    <thead>
		<tr class="tableHead">
            {hasRight rule=$moduleName|cat:"_Edit "|cat:$moduleName|cat:"_Delete"}
		    <th style="width:40px"><input type="checkbox" class="checkAll select" /></th>
            {/hasRight}
		    <th colspan="2">{t}Status{/t}</th>
            <th><a href="javascript:void(0);" class="{if $sortParams.column == "document_label"}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == "document_label"}{$sortParams.order}{else}asc{/if}" name="document_label">{t}Label{/t}</a></th>
		    {if count($columns) > 0}
		    {foreach from=$columns item=column}
            <th>
                {if isset($column.column.docColumn)}
                <a href="javascript:void(0);" class="{if $sortParams.column == $column.column.docColumn}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == $column.column.docColumn}{$sortParams.order}{else}asc{/if}" name="{$column.column.docColumn}">{$column.column.label}</a>
                {else}
                    {$column.column.label}
                {/if}
            </th>
		    {/foreach}
		    {/if}
            <th style="width:40px"><a href="javascript:void(0);" class="{if $sortParams.column == "document_uid"}{$sortParams.class}{else}no-sort{/if}" title="{if $sortParams.column == "document_uid"}{$sortParams.order}{else}asc{/if}" name="document_uid">ID</a></th>
		</tr>
        <tr class="searchBar">
            {hasRight rule=$moduleName|cat:"_Edit "|cat:$moduleName|cat:"_Delete"}
            <th></th>
            {/hasRight}
            <th colspan="2"></th>
            <th><input type="text" name="document_label" value="{if isset($docSearchParams.document_label)}{$docSearchParams.document_label}{/if}"/></th>
		    {if count($columns) > 0}
		    {foreach from=$columns item=column}
            <th>
                {assign var="value" value=$column.column.docColumn}
                <input type="{$column.search.type}" class="{$column.search.class}" name="{$column.column.docColumn}" value="{if isset($docSearchParams.$value)}{$docSearchParams.$value}{/if}" />
            </th>
		    {/foreach}
		    {/if}
            <th class="searchId"><input type="text" name="document_uid" value="{if isset($docSearchParams.document_uid)}{$docSearchParams.document_uid}{/if}" /></th>
        </tr>
	    </thead>
	    <tbody {if $isSortable}id="sortable"{else}class="documentListItems"{/if}>
	    {foreach from=$documents key=key item=document name=document}
		<tr id="{$document->getUniqueId()}">
            {hasRight rule=$moduleName|cat:"_Edit "|cat:$moduleName|cat:"_Delete"}
		    <td style="text-align: center;">
                {if $isSortable}{backend_image file="mover.png" class="sortableIcon"}{/if}
                {hasDocRight document=$document module=$moduleName rule="edit delete"}
                    <input type="checkbox" class="select" value="{$document->getUniqueId()}" name="check_rep[{$key}]" id="checkBox_{$document->getUniqueId()}"/>
                {hasDocRightElse}
                    <input type="checkbox" class="select" value="{$document->getUniqueId()}" name="check_rep[{$key}]" id="checkBox_{$document->getUniqueId()}" disabled />
                {/hasDocRight}
            </td>
            {/hasRight}
            <td style="width: 40px; text-align: center;">
                <span class="listButtons">
                    {hasRight rule=$moduleName|cat:"_Delete"}
                    {hasDocRight document=$document module=$moduleName rule="delete"}
                    <a href="{$URL_RELATIVE}/bo/#{url route='deleteGeneric' moduleName=$document->getDocumentModuleName() docId=$document->getUniqueId() docLang=$document->getLang()}" class="nyroModal itemButton itemDeleteButton"></a>
                    {/hasDocRight}
                    {/hasRight}
                    
                    {hasRight rule=$moduleName|cat:"_Edit"}
                    {hasDocRight document=$document module=$moduleName rule="edit"}
                    <a href="{$URL_RELATIVE}/bo/#{$document->getEditUrl()}" class="nyroModal itemButton itemEditButton defaultAction"></a>
                    {/hasDocRight}
                    {/hasRight}
                </span>
            </td>
            <td style="width: 8px; text-align: center;">
                {assign var='status' value=$document->getPublicationStatus()}
                {hasRight rule=$moduleName|cat:"_Edit"}
                    {hasDocRight document=$document module=$moduleName rule="edit"}
                        {publicationStatusSwitch document=$document}
                    {hasDocRightElse}
                        {icon name=status/$status}
                    {/hasDocRight}
                {hasRightElse}
                    {icon name=status/$status}
                {/hasRight}
            </td>
		    <td>{$document->getLabel()|truncate:50:"...":true|escape:"html"}</td>
		    {if count($columns) > 0}
		    {foreach from=$columns item=column}
		    <td {if isset($column.column.style)} style="{$column.column.style}"{/if}>{php}$document = $this->_tpl_vars["document"]; $method = $this->_tpl_vars["column"]["column"]["docMethod"]; eval('$value = $document->'.$method.';'); if($value == ""){echo "/";}else{echo $value;}{/php}</td>
		    {/foreach}
		    {/if}
		    <td style="width: 60px; text-align: center;">{$document->getUniqueId()}</td>
		</tr>
	    {/foreach}
	    </tbody>
	</table>
    <div id="result" style="display: none">&folderId={$folder->getUniqueId()}&recursive={$params.deleteRecursive}</div>
	<div id="selectResult" style="display: none"></div>
    {/if}
{else}
	{block module="backoffice" action="editFolder"}
{/if}

{literal}
<script language="type/javascript">
    column = "{/literal}{$sortParams.column}{literal}";
    order = "{/literal}{$sortParams.order}{literal}";
    searchValues = "{/literal}{$searchParams}{literal}";

    $(document).ready(function(){
        search();
        sort();
    });
</script>
{/literal}
</div>